package com.mxpio.erp.purchase.provider;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.mxpio.erp.common.inventory.service.SupplyChainService;
import com.mxpio.erp.common.order.policy.OrderContext;
import com.mxpio.erp.common.order.provider.OrderContextProvider;
import com.mxpio.erp.common.purchase.entity.PurchaseOrder;

@Component
public class PurchaseOrderContextProvider implements OrderContextProvider {
	
	@Autowired(required = false)
	private SupplyChainService supplyChainService;

	@Override
	public boolean supports(Class<?> clazz) {
		if(clazz == PurchaseOrder.class) {
			return true;
		}
		return false;
	}

	@Override
	public void provide(OrderContext context) {
		if(supplyChainService != null){
			supplyChainService.check(context);
		}
	}

}
